<?xml version="1.0" encoding="UTF-8"?>
<definitions id="definitions" 
  xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
  xmlns:camunda="http://camunda.org/schema/1.0/bpmn"
  targetNamespace="Examples">
	
	<process id="compensateProcess" isExecutable="true">

		<startEvent id="start" />
		
		<sequenceFlow sourceRef="start"	targetRef="scope" />

		<subProcess id="scope">
		
			<multiInstanceLoopCharacteristics isSequential="true">
				<loopCardinality>5</loopCardinality>
			</multiInstanceLoopCharacteristics>

			<startEvent id="startInScope" />
			
			<sequenceFlow sourceRef="startInScope" targetRef="bookHotel" />

			<serviceTask id="bookHotel" camunda:expression="${true}">
				
			</serviceTask>		
				
			<boundaryEvent id="compensateBookHotelEvt" name="Boundary event" attachedToRef="bookHotel">
				<compensateEventDefinition />
			</boundaryEvent>		
			
			<!-- the compensation handler is a call-activity -->
			<callActivity id="undoBookHotel" isForCompensation="true" calledElement="compensationHandler" />
						
			<sequenceFlow sourceRef="bookHotel" targetRef="endInScope" />
			
			<endEvent id="endInScope" />
				
			<association associationDirection="One" sourceRef="compensateBookHotelEvt" targetRef="undoBookHotel" />

		</subProcess>

		<sequenceFlow sourceRef="scope" targetRef="throwCompensate" />
		
		<intermediateThrowEvent id="throwCompensate">
			<compensateEventDefinition activityRef="scope" />
		</intermediateThrowEvent>
		
		<sequenceFlow sourceRef="throwCompensate" targetRef="beforeEnd" />
		<sequenceFlow sourceRef="beforeEnd" targetRef="end" />
		
		<receiveTask id="beforeEnd" />
		
		<endEvent id="end" />
	</process>

</definitions>
